<?php
/**
 * Created by Alan.
 * User: Alan
 * Date: 2018\10\8 0008
 * Time: 11:54
 */

namespace app\api\controller;
use app\common\model\Category as CategoryModel;


use think\Controller;

class Category extends Controller
{
    public function getCategoryByParentId()
    {
        if(!request()->isPost()){
            return show(0,'error');
        }

        $id = intval(input('post.id',0));
        if(!$id){
            return show(0,'error');
        }

        $categories = CategoryModel::getNomalCategoryByParentId($id);
        if($categories){
            return show(1,'success',$categories);
        }
        else {
            return show(0,'error');
        }
    }
}